<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:89:"D:\phpstudy_pro\WWW\thinkphp\public/../application/admin\view\user\recharge\recharge.html";i:1648458536;s:68:"D:\phpstudy_pro\WWW\thinkphp\application\admin\view\common\meta.html";i:1647074041;}*/ ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<title><?php echo $System['SiteName']['value']; ?></title>

<meta name="keywords" content="<?php echo $System['keywords']['value']; ?>" />
<meta name="description" content="<?php echo $System['description']['value']; ?>" />
<link rel="shortcut icon" href="<?php echo $System['SiteLogo']['value']; ?>" />

<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/assets/admin/css/font.css">
<link rel="stylesheet" href="/assets/admin/css/xadmin.css">

<script src="/assets/admin/js/jquery.min.js"></script>
<script src="/assets/admin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/assets/admin/js/xadmin.js"></script>
</head>

<body>
    <div class="x-body">
        <xblock>
            <button class="layui-btn layui-btn-danger" onclick="delAll()">
                <i class="layui-icon"></i>批量删除
            </button>

            <span class="x-right" style="line-height:40px">
                
                共有数据：<?php echo $count; ?> 条
                
            </span>
        </xblock>

        <table class="layui-table">
            <thead>
                <tr>
                    <th>
                        <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                                class="layui-icon">&#xe605;</i></div>
                    </th>
                    <th>变化的积分</th>
                    <th>用户名</th>
                    <th>状态消费积分状态</th>
                    <th>消费描述</th>
                    <th>消费时间</th>
                    <th>操作</th>
            </thead>

            <tbody>
                <?php foreach($countlist as $item): ?>
                
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id="<?php echo $item['id']; ?>">
                            <i class="layui-icon">&#xe605;</i>
                        </div>
                    </td>
                    
                    <td><?php echo $item['point']; ?></td>
                    <td><?php echo $item['user']['nickname']; ?></td>
                    <td><?php echo $item['state']; ?></td>
                    <td><?php echo $item['content']; ?></td>
                    <td><?php echo $item['createtime']; ?></td>    
                    <td>
                        <a title="删除" href="javascript:;" onclick="deletes(`<?php echo $item['id']; ?>`)">
                            <i>删除记录</i>
                        </a>
                    </td>

                    
                </tr>
            
                <?php endforeach; ?>
            </tbody>
        </table>

        <div class="page">
            <?php echo $pagestr; ?>
        </div>

    </div>
</body>

</html>
<script>
    // 批量删除
    function delAll() {
        var ids = tableCheck.getData()
        layer.confirm('确认要删除吗？', function (index) {
            //将数组转换为字符串
            var data = ids.join(',');
            del(data)
        })
    }

    // 单个删除
    function deletes(id) {
        layer.confirm('确认要删除吗？', function (index) {
            layer.close(index);
            del(id)
        })
    }

    // 调用删除方法
    function del(data) {
        //序列化 将对象转换为参数形式
        var params = {
            ids: data
        }

        params = $.param(params)

        $.ajax({
            type: "POST",
            url: `<?php echo url('admin/user.recharge/del'); ?>`,
            data: params,
            dataType: "json",
            success: function (data) {
                layer.msg(data.msg, { icon: 5, time: 1000 }, function () {
                    location.reload()
                })
            }
        })
    }
</script>